package p270jp.pxv.android.activity;

import android.os.Bundle;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.BackStackRecord;
import androidx.recyclerview.widget.GridLayoutManager;
import p014ae.AbstractActivityC0093i1;
import p014ae.C0190y4;
import p014ae.C0199z4;
import p045be.IllustNoInfoRecyclerAdapter;
import p090d0.C2518n;
import p134ei.AnalyticsScreenName;
import p134ei.PixivAnalytics;
import p165fo.C3114c;
import p165fo.Subscribe;
import p210hh.PixivAccountManager;
import p270jp.pxv.android.R;
import p270jp.pxv.android.legacy.event.FinishLogin;
import p314lg.ActivityLoginBinding;
import p393of.C5453b;
import p402om.WalkThroughIllustService;
import p436q6.StringMerger;
import p447qi.EventPublishDialogFragment;
import p451qm.ItemDecoration;
import p491sd.C6034a;
import p547uh.LoginOrEnterNickNameFragment;
import p645yc.AndroidSchedulers;
import p671zc.CompositeDisposable;

/* renamed from: jp.pxv.android.activity.LoginFromAuthenticatorActivity */
/* loaded from: classes2.dex */
public class LoginFromAuthenticatorActivity extends AbstractActivityC0093i1 {

    /* renamed from: A */
    public static final /* synthetic */ int f18388A;

    /* renamed from: w */
    public final AnalyticsScreenName f18389w = AnalyticsScreenName.LOGIN;

    /* renamed from: x */
    public CompositeDisposable f18390x = new CompositeDisposable();

    /* renamed from: y */
    public ActivityLoginBinding f18391y;

    /* renamed from: z */
    public WalkThroughIllustService f18392z;

    @Override // p263ji.AppCompatAccountAuthenticatorActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.f18391y = (ActivityLoginBinding) DataBindingUtil.m11369d(this, R.layout.activity_login);
        ((PixivAnalytics) C2518n.m7641d(PixivAnalytics.class)).m6525e(this.f18389w);
        this.f18392z = (WalkThroughIllustService) C2518n.m7641d(WalkThroughIllustService.class);
        C3114c.m6284b().m6276j(this);
        GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
        IllustNoInfoRecyclerAdapter uVar = new IllustNoInfoRecyclerAdapter(this, this.f936e);
        uVar.f4644n = true;
        this.f18391y.f22264r.setLayoutManager(gridLayoutManager);
        this.f18391y.f22264r.m10871g(new ItemDecoration(this, gridLayoutManager));
        this.f18391y.f22264r.setAdapter(uVar);
        this.f18390x.mo82c(this.f18392z.m3213a().m966j(AndroidSchedulers.m334a()).m961o(C6034a.f26178c).m963m(new C0190y4(this, uVar, 0), C0199z4.f693b));
        BackStackRecord cVar = new BackStackRecord(m11131K0());
        cVar.m11165j(R.id.fragment_container, LoginOrEnterNickNameFragment.m1702g(false, false));
        cVar.mo11171d();
        if (((PixivAccountManager) C2518n.m7641d(PixivAccountManager.class)).m5507i()) {
            StringMerger.m2843s(m11131K0(), EventPublishDialogFragment.f25435a.m2777b(getString(R.string.cant_add_account), getString(R.string.common_ok), null, new FinishLogin(), null, null, false), "fragment_tag_already_logged_in");
        }
    }

    @Override // p116e.ActivityC2727f, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onDestroy() {
        this.f18390x.m80f();
        C3114c.m6284b().m6274l(this);
        super.onDestroy();
    }

    @Subscribe
    public void onEvent(FinishLogin finishLogin) {
        finish();
    }

    @Override // android.app.Activity, android.view.Window.Callback
    public void onWindowFocusChanged(boolean z) {
        super.onWindowFocusChanged(z);
        if (z) {
            C5453b.m3260s(this);
        }
    }
}
